package com.a2.appa3.presenter.activity;

import com.a2.appa3.model.CustomObserver;
import com.a2.appa3.model.network.HttpJsonUtils;
import com.a2.appa3.model.network.entity.req.ResURL;
import com.a2.appa3.ui.activity.SplashActivity;
import com.a2.appa3.util.SYSOUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/8/4.
 * SplashActivityPresenter
 */

public class SplashActivityPresenter extends BaseActivityPresenter<SplashActivity> {
    public SplashActivityPresenter(SplashActivity mActivity) {
        super(mActivity);
    }

    public void test() {
        HttpJsonUtils.getHttpApiInstance()
                .getUrlList("http://oss.ag142536.com/a1and.json")
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResURL>(mActivity) {
                    @Override
                    public void onNext(ResURL resURL) {
                        SYSOUtils.sOut_("解析域名为" + resURL.toString());
                        mActivity.succsec(resURL);
                    }

                    @Override
                    protected void onCustomNext(ResURL resURL) {

                    }

                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {

                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {
                    }
                });
    }
}
